package com.ququ.syb.balance.service;

import com.ququ.syb.balance.redis.RedisDao;
import com.ququ.syb.common.constant.IdSequenceConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;

@Service
public class AccountChannelBalanceIdSequenceService {
    @Autowired
    private RedisDao redisDao;

    public Long getNextId(){
        Jedis jedis = redisDao.getJedis();
        try {
            return jedis.incr(IdSequenceConstant.SEQ_ACCOUNTCHANNELBALANCE_ID);
        }finally {
            redisDao.close(jedis);
        }
    }
}
